﻿<Window x:Class="Deployment.Data.UI.Dialogs.Connection.EditConnectionDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:connections="clr-namespace:Deployment.Data.UI.Controls.Connection"
        Title="Add New Connection" Height="300" Width="300" WindowStartupLocation="CenterOwner" SizeToContent="WidthAndHeight" ShowInTaskbar="False"
        Closing="Window_Closing"
        DataContext="{Binding ElementName=Control, Path=DataContext, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True}" ResizeMode="NoResize">
    <StackPanel Orientation="Vertical">
        <connections:ConnectionEditorControl x:Name="Control"/>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <StackPanel Orientation="Horizontal" 
                        Grid.Column="1" Grid.Row="0"
                        HorizontalAlignment="Right">
                <Button Name="okButton" 
                    Click="okButton_Click" 
                    Padding="8,4,8,4"
                    Margin="2"
                    IsEnabled="{Binding Path=IsConnectionDataValid, 
                                        Mode=OneWay,
                                        NotifyOnSourceUpdated=True, 
                                        NotifyOnTargetUpdated=True,
                                        BindsDirectlyToSource=True,
                                        FallbackValue=False,
                                        UpdateSourceTrigger=PropertyChanged,
                                        TargetNullValue=False
                            }">OK</Button>
                <Button Name="cancelButton" 
                        IsCancel="True"
                        Padding="4"
                        Margin="2">Cancel</Button>
            </StackPanel>

            <Button Grid.Column="0" Grid.Row="0"
                    HorizontalAlignment="Left" Padding="8,4,8,4" 
                    Content="Test connection"
                    Click="Test_Click"
                    x:Name="btn_TestConnection"
                    Margin="2"
                    IsEnabled="{Binding Path=IsConnectionDataValid, 
                                        Mode=OneWay,
                                        NotifyOnSourceUpdated=True, 
                                        NotifyOnTargetUpdated=True,
                                        BindsDirectlyToSource=True,
                                        FallbackValue=False,
                                        UpdateSourceTrigger=PropertyChanged,
                                        TargetNullValue=False
                            }"/>
        </Grid>
        
    </StackPanel>
</Window>
